package com.alipay.controller;

import com.alipay.pojo.Order;
import com.alipay.service.AliPayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 支付宝沙箱测试 controller
 *
 * @Author axin
 * @Date 2021/12/4 11:24
 **/
@RestController
public class PayController {

    @Autowired
    private AliPayService aliPayService;
    /**
     * 支付宝支付 api
     *
     */
    @PostMapping(value = "/order/alipay")
    public String alipay()  {
        Order order = new Order();
        /**
         * iphone 13 pro
         * 收款方：	xfulev3830@sandbox.com
         * 订单号：	45787897897897896454
         * 商品名称：	iphone 13 pro
         * 交易金额：	1669.90
         */
        order.setOut_trade_no("45787897897897896454");
        order.setSubject("iphone 13 pro");
        order.setTotal_amount("1669.9");
        order.setDescription("");
        return aliPayService.aliPay(order);
    }

}
